-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add manual address entry to letter form #1775
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all looks good. have some naming suggestions that I think would be easier to read.
src/components/common/PropTypes.ts
Outdated
addText: string | ((listItems: Array<TModel>) => string); | ||
modelFactory: () => TModel; | ||
updateModel: (value: Array<TModel>) => void; | ||
eachRender: (updateModel: (value: TModel) => void) => JSX.Element; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe "renderChild" or "renderEntry" or "renderListEntry"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updateModel => onItemUpdated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think renderListItem and onListItemUpdated to keep consistent with the rest of it
src/components/common/PropTypes.ts
Outdated
export interface DynamicListProps<TModel> { | ||
addText: string | ((listItems: Array<TModel>) => string); | ||
modelFactory: () => TModel; | ||
updateModel: (value: Array<TModel>) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onItemsUpdated? onListItemsUpdated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This, I like- it has the potential to be used for more than just updating the model, and I will include it in a new commit 😊
@@ -0,0 +1,6 @@ | |||
export interface DynamicListProps<TModel> { | |||
addText: string | ((listItems: Array<TModel>) => string); | |||
modelFactory: () => TModel; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
emptyModelFactory? defaultModelFactory? createEmptyModel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure those names would be appropriate, since the consumer could definitely create a filled or partially-filled model through a closure, and there would not be anything non-default that seems like it would call for using "default". Is there something you're thinking of that I'm missing?
|
||
type AddressInputProps = { | ||
/** callback function for every time the address is updated */ | ||
updateParent: (a: LobAddress) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onAddressUpdated?
This PR adds a generic arbitrary-length list component, used in the letter form to allow users to input addresses that are not populated automatically from the Civic API.
Closes #1717